#ifndef EMBUSLIB_H
#define EMBUSLIB_H

#include <string>

#define EMBUSLOG_LEVEL_DBG     0
#define EMBUSLOG_LEVEL_INFO    1
#define EMBUSLOG_LEVEL_WARN    2
#define EMBUSLOG_LEVEL_ERROR   3

#define EMBUS_BMR_CTRL_ID      0x100 //发布 CAN总线报文/控制RMU DO输出
#define EMBUS_BMR_DAT_ID       0x101 //订阅 CAN/LIN报文/RMU ADC/DI/DO状态
#define EMBUS_VCI_REQ_ID       0x102 //发布 VCI 请求消息，用来设置底层接口的功能(can/lin/rtc/do/led)
#define EMBUS_VCI_RESP_ID      0x103 //订阅 VCI 应答消息，返回请求应答
#define EMBUS_GPS_DAT_ID       0x104 //订阅 EMBUS_GPS_DAT_ID 和 GPS位置 状态消息
#define EMBUS_CANTP_REQ_ID     0x105 //发布 cantp 请求消息
#define EMBUS_CANTP_RESP_ID    0x106 //订阅 cantp 回复消息
#define EMBUS_DORMANCY_CMD_ID  0x107 //订阅 系统即将休眠消息(有且只有一次信息)
#define EMBUS_STATUS_ID        0x108 //订阅 RMU ADC/DI/DO/LED的状态数据

struct embus_handle_t
{
  std::string val;
};

typedef void (*msg_rx_handle)(unsigned int pkt_id, unsigned char *data, int data_len,void *param);

embus_handle_t* embus_connect(const char* bus_name, const char* client_name, msg_rx_handle rx_proc, void* param);
void embus_msg_subscribe(embus_handle_t* handle, uint32_t* topicids, uint16_t size);
int embus_msg_send(embus_handle_t* handle, uint32_t topicid, uint8_t* data, uint16_t size);
int embuslog_write(embus_handle_t* handle,uint8_t level, const char* message);
int embus_disconnect(embus_handle_t* handle);

#endif